<?php defined('InShopNC') or exit('Access Invalid!');?>
<link rel="stylesheet" type="text/css" href="<?php echo TEMPLATES_PATH;?>/css/login.css">
<script type="text/javascript" src="<?php echo RESOURCE_PATH;?>/js/jquery.validation.min.js"></script>
<header class="layout head padding-small">
    <a href="javascript:back(true);" class="hBack float-left"></a>
    <h4 class="hTxt float-left text-center text-white">活动报名</h4>
    <a href="javascript:;" id="btnJdkey" class="hHlep float-right"></a>
</header>
<div style="max-width: 100%">
    <div>
         <img width="100%" src="<?php echo TEMPLATES_PATH?>/images/sign_up_intro.jpg" />
    </div>
 <div style="padding: 10px;">
    <form action="#" method="post" id="sign_form">
        <input type="hidden" name="form_submit" value="ok" />

                    <span class="new-input-span mg-b15">
                        <input type="text" class="new-input" name="sign_name" id="sign_name" placeholder="姓名" />
                    </span>
                    <span class="new-input-span mg-b15">
                        <input type="text" value="" class="new-input" name="sign_phone" id="sign_phone" placeholder="电话" >
                    </span>

                   <span class="new-input-span mg-b15">
                        性别：
                        <input id="sign_sex1" name="sign_sex" value="<?php echo SIGN_UP_MAN;?>" type="radio" checked="checked">
                        <label class="pad" for="sign_sex1">男</label>&nbsp;
                        <input id="sign_sex2" name="sign_sex" value="<?php echo SIGN_UP_WOMAN;?>" type="radio">
                        <label class="pad" for="sign_sex2">女</label>&nbsp;
                    </span>
                    <span class="new-input-span mg-b15">
                        <input type="text" value="" class="new-input" name="sign_addr" id="sign_addr" placeholder="地址" >
                    </span>
        <span class="new-input-span mg-b15">
                        <input type="text" value="" class="new-input" name="sign_shop_name" id="sign_shop_name" placeholder="店名" >
                    </span>
				 <input type="submit" value="报名" class="submit_style" />
    </form>
 </div>
</div>

<script type="text/javascript">
    $(document).ready(function(){
        //添加验证手机号或座机号的方法
        jQuery.validator.addMethod("mob_rul", function(value, element) {
            return this.optional(element) || /^(1[3578]\d{9}|((0[0-9]{2,3})-)([0-9]{7,8})(-([0-9]{3,}))?)$/.test(value);
        });
        $("#sign_form").validate({
            errorPlacement: function(error, element){
                var error_td = element.parent('span');
                error_td.find('label').hide();
                error_td.append(error);
            },
            rules: {
                sign_name: {
                    required	: true,
                    maxlength	: 30
                },
                sign_phone: {
                    required	: true,
                    mob_rul 	: true,
                    remote   : {
                        url : 'index.php?act=sign_up&op=checkMobile',
                        type: 'post',
                        data:{
                            sign_phone : function(){
                                return $('#sign_phone').val();
                            }
                        }
                    }
                },
                sign_addr: {
                    required	: true,
                    maxlength	: 50
                },
                sign_shop_name: {
                     required	: true,
                    maxlength	: 30
              }
    },

            messages: {
                sign_name: {required:"姓名不能为空",maxlength:"姓名不合法"},
                sign_phone:{required:"电话号码不能为空",mob_rul:"请输入正确的手机或座机号",remote:'电话号码已存在'},
                sign_addr: {required:'地址不能为空',maxlength:'地址不合法'},
                sign_shop_name: {required:'店名不能为空',maxlength:"店名不合法"}
            }
        });
    });
</script>